home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Source / Asm / Chunky / ChunkySingle.s < prev    next >
Encoding:
Text File  |  1998-03-16  |  4.7 KB  |  200 lines

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;This demo is like the other pixel list demos but uses a CHUNKY8 screen type.
  3. ;Then screen size has been kept very small as the C2P routine is too slow,
  4. ;but this will be improved in the next version.  The good thing is that
  5. ;because the routine is transparent, using a graphics card would mean that
  6. ;this demo would run at the maximum possible speed (ie the chunky screen
  7. ;would be displayable, so no c2p would be needed).
  8. ;
  9. ;Press LMB to exit.
  10.  
  11.     INCDIR    "INCLUDES:"
  12.     INCLUDE    "dpkernel/dpkernel.i"
  13.  
  14.     SECTION    "Demo",CODE
  15.  
  16. ;===========================================================================;
  17. ;                             INITIALISE DEMO
  18. ;===========================================================================;
  19.  
  20.     STARTDPK
  21.  
  22. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  23.     move.l    DPKBase(pc),a6
  24.     lea    ScreenTags(pc),a0
  25.     sub.l    a1,a1
  26.     CALL    Init
  27.     tst.l    d0
  28.     beq.s    .Exit
  29.  
  30.     moveq    #ID_JOYDATA,d0    ;Get joydata structure.
  31.     CALL    Get
  32.     move.l    d0,JoyData
  33.     beq.s    .Exit
  34.     move.l    d0,a0    ;Initialise the joydata structure.
  35.     sub.l    a1,a1
  36.     CALL    Init
  37.     tst.l    .Exit
  38.  
  39.     move.l    Screen(pc),a0
  40.     CALL    Display
  41.  
  42.     bsr.s    Main
  43.  
  44. .Exit    move.l    DPKBase(pc),a6
  45.     move.l    JoyData(pc),a0
  46.     CALL    Free
  47.     move.l    Screen(pc),a0
  48.     CALL    Free
  49.     MOVEM.L    (SP)+,A0-A6/D1-D7
  50.     moveq    #ERR_OK,d0
  51.     rts
  52.  
  53. ;===========================================================================;
  54. ;                                MAIN LOOP
  55. ;===========================================================================;
  56.  
  57. Main:
  58. .loop    move.l    DPKBase(pc),a6
  59.     move.l    Screen(pc),a1
  60.     move.l    GS_Bitmap(a1),a0
  61.     CALL    Clear
  62.  
  63.     lea    MList(pc),a2    ;a2 = Pointer to pixel list.
  64.     move.l    a2,a3    ;Drop the pixels here.
  65.     moveq    #31-1,d7
  66. .drop    addq.w    #1,2(a3)    ;a3 = YCoord+1
  67.     subq.l    #1,4(a3)    ;a3 = (Colour)-1
  68.     bge.s    .colok
  69.     clr.l    4(a3)
  70. .colok    addq.w    #8,a3
  71.     dbra    d7,.drop
  72.  
  73.     move.l    DPKBase(pc),a6
  74.     lea    MouseX(pc),a5
  75.     move.l    JoyData(pc),a0
  76.     CALL    Query
  77.  
  78.     move.l    JoyData(pc),a0
  79.     move.l    JD_Buttons(a0),d0
  80.     btst    #JB_LMB,d0
  81.     bne.s    .done
  82.  
  83.     move.w    JD_XChange(a0),d0
  84.     move.w    JD_YChange(a0),d1
  85.  
  86.     add.w    d1,2(a5)    ;d1 = (MouseY)+ChangeY
  87.     add.w    (a5),d0
  88.     move.l    Screen(pc),a0
  89. .ChkRX    cmp.w    GS_Width(a0),d0
  90.     blt.s    .ChkLX
  91.     move.w    GS_Width(a0),(a5)
  92.     bra.s    .Calculate
  93.  
  94. .ChkLX    tst.w    d0
  95.     bgt.s    .okX
  96.     clr.w    (a5)
  97.     bra.s    .Calculate
  98. .okX    move.w    d0,(a5)
  99.  
  100. .Calculate
  101.     move.l    (a5),-(sp)
  102.     moveq    #2,d1
  103.     CALL    FastRandom
  104.     subq.w    #1,d0
  105.     add.w    d0,(a5)
  106.  
  107.     moveq    #2,d1
  108.     CALL    FastRandom
  109.     subq.w    #1,d0
  110.     add.w    d0,2(a5)
  111.  
  112.     move.l    a2,a3
  113.     moveq    #31-1,d7
  114. .tloop    move.l    8(a3),(a3)
  115.     move.l    12(a3),4(a3)
  116.     addq.w    #8,a3
  117.     dbra    d7,.tloop
  118.  
  119.     move.l    BLTBase(pc),a6
  120.     move.l    Screen(pc),a0
  121.     move.l    GS_Bitmap(a0),a0
  122.     lea    PixelList(pc),a1    ;a1 = Pixel list.
  123.     CALL    bltDrawPixelList    ;>> = Draw pixels with clipping.
  124.     move.l    (sp)+,(a5)
  125.  
  126.     move.l    SCRBase(pc),a6
  127.     CALL    scrWaitAVBL
  128.     bra    .loop
  129. .done    rts
  130.  
  131. ;===========================================================================;
  132. ;                                  DATA
  133. ;===========================================================================;
  134.  
  135. JoyData:    dc.l  0
  136.  
  137. ScreenTags:    dc.l  TAGS_SCREEN
  138. Screen:        dc.l  0
  139.         dc.l  GSA_Width,256
  140.         dc.l  GSA_Height,128
  141.         dc.l  GSA_Attrib,SCR_CENTRE
  142.         dc.l    GSA_BitmapTags,0
  143.         dc.l    BMA_Palette,.palette
  144.         dc.l    BMA_Type,CHUNKY8
  145.         dc.l    TAGEND,0
  146.         dc.l  TAGEND
  147.  
  148. .palette    dc.l  PALETTE,32
  149.         dc.l  $000000,$101010,$171717,$202020,$272727,$303030
  150.         dc.l  $373737,$404040,$474747,$505050,$575757,$606060
  151.         dc.l  $676767,$707070,$777777,$808080,$878787,$909090
  152.         dc.l  $979797,$a0a0a0,$a7a7a7,$b0b0b0,$b7b7b7,$c0c0c0
  153.         dc.l  $c7c7c7,$d0d0d0,$d7d7d7,$e0e0e0,$e0e0e0,$f0f0f0
  154.         dc.l  $f7f7f7,$ffffff
  155.  
  156. PixelList:    dc.w   32,PXL_SIZEOF    ;Amount of entries, EntrySize.
  157.         dc.l   MList    ;Pointer to pixel list array.
  158. MList:        PIXEL  16,12,00    ;First pixel to draw (at back)
  159.         PIXEL  16,12,00    ;X/Y/Colour
  160.         PIXEL  16,12,00    ;..
  161.         PIXEL  16,12,00    ;..
  162.         PIXEL  16,12,00    ;..
  163.         PIXEL  16,12,00    ;..
  164.         PIXEL  16,12,00    ;..
  165.         PIXEL  16,12,00    ;..
  166.         PIXEL  16,12,00    ;..
  167.         PIXEL  16,12,00    ;..
  168.         PIXEL  16,12,00    ;..
  169.         PIXEL  16,12,00    ;..
  170.         PIXEL  16,12,00    ;..
  171.         PIXEL  16,12,00    ;..
  172.         PIXEL  16,12,00    ;..
  173.         PIXEL  16,12,00    ;..
  174.         PIXEL  16,12,00    ;..
  175.         PIXEL  16,12,00    ;..
  176.         PIXEL  16,12,00    ;..
  177.         PIXEL  16,12,00    ;..
  178.         PIXEL  16,12,00    ;..
  179.         PIXEL  16,12,00    ;..
  180.         PIXEL  16,12,00    ;..
  181.         PIXEL  16,12,00    ;..
  182.         PIXEL  16,12,00    ;..
  183.         PIXEL  16,12,00    ;..
  184.         PIXEL  16,12,00    ;..
  185.         PIXEL  16,12,00    ;..
  186.         PIXEL  16,12,00    ;..
  187.         PIXEL  16,12,00    ;..
  188.         PIXEL  16,12,00    ;..
  189. MouseX:        PIXEL  16,12,31    ;Last pixel to draw (in front)
  190.  
  191. ;===========================================================================;
  192.  
  193. ProgName:    dc.b  "Chunky Pixels",0
  194. ProgAuthor:    dc.b  "Paul Manias",0
  195. ProgDate:    dc.b  "February 1998",0
  196. ProgCopyright:    dc.b  "DreamWorld Productions (c) 1996-1998.  Freely distributable.",0
  197. ProgShort:    dc.b  "Chunky demo, single buffer.",0
  198.         even
  199.  
  200.